package com.cj.peiwan.server.other;

import com.google.gson.Gson;
import org.wei.utils.StringUtil;

import java.util.Map;
import java.util.SortedMap;

public class Global {
    private static Gson gson = new Gson();

    public static Gson getGson() {
        return gson;
    }

    public static String userId2ChatId(long userId) {
        return "product_" + userId;
    }
    public static String wxSign(SortedMap<String, Object> map) {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry entry : map.entrySet()) {
            sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
        }
        sb.append("key=" + "IJR4681LYNZD1QHZOC3MOHL3KGW42W96");
        return StringUtil.md5(sb.toString()).toUpperCase();
    }
}
